package ooday05;

public class AnimalTest {
    public static void main(String[] args) {
        Animal [] animal = new Animal[5];
        animal[0] = new Dog("1",1,"111");
        animal[1] = new Dog("2",2,"222");
        animal[2] = new Dog("3",3,"333");
        animal[3] = new Dog("4",4,"444");
        animal[4] = new Dog("5",5,"555");
        for (int i = 0; i < animal.length; i++) {
            System.out.println(animal[i].name);
            animal[i].drink();
            animal[i].eat();
            if(animal[i] instanceof Dog){
                Dog dog = (Dog) animal[i];
                dog.lookHome();
            }
            if (animal[i] instanceof Fish){
                Fish fish = (Fish) animal[i];
                fish.swim();
            }
            if (animal[i] instanceof Chick){
                Chick chick = (Chick) animal[i];
                chick.layEggs();
            }
        }

        System.out.println();
        Master m = new Master();
        for (int i = 0; i < animal.length; i++) {
            m.feed(animal[i]);
        }



    }
}
